Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

joycon

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joycon

Load config with ease.

  • 3.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is joycon?

Joycon is a configuration file loader for Node.js that supports multiple formats such as JSON, YAML, and JavaScript. It allows you to load and merge configuration files from different sources, making it easier to manage application settings.

What are joycon's main functionalities?

Load Configuration Files

This feature allows you to load configuration files in different formats. The code sample demonstrates how to load JSON and YAML configuration files and access the merged configuration data.

const JoyCon = require('joycon');
const joycon = new JoyCon();

joycon.load(['config.json', 'config.yaml']).then(result => {
  console.log(result.data);
});

Specify Custom Loaders

Joycon allows you to specify custom loaders for different file formats. The code sample shows how to add a custom loader for files with a '.custom' extension and load them using Joycon.

const JoyCon = require('joycon');
const joycon = new JoyCon();

joycon.addLoader({
  test: /\.custom$/, // Regex to match custom file extension
  load: async (filePath) => {
    const content = await fs.promises.readFile(filePath, 'utf8');
    return parseCustomFormat(content); // Custom parsing logic
  }
});

joycon.load(['config.custom']).then(result => {
  console.log(result.data);
});

Merge Configuration Files

Joycon can merge multiple configuration files into a single configuration object. The code sample demonstrates how to load and merge JSON and YAML configuration files.

const JoyCon = require('joycon');
const joycon = new JoyCon();

joycon.load(['config.json', 'config.yaml']).then(result => {
  const mergedConfig = result.data;
  console.log(mergedConfig);
});

Other packages similar to joycon

FAQs

Package last updated on 01 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc